/**
 * 
 */
package com.ccrc.main;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author Jalen
 *
 */
public class Provider {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:dubbo-provider.xml");
		context.start();
		
		String[] names = context.getBeanDefinitionNames();
		for (String string : names) {
			System.out.print(string + ",");
			System.out.println();
		}

		// 为保证服务一直开着，一直循环等待
		synchronized (Provider.class) {
			while (true) {
				try {
					Provider.class.wait();
				} catch (Throwable e) {
					System.out.println("服务异常：" + e.toString());
					if (context.isActive()) {
						context.close();
					}
				}
			}
		}
		

	}

}
